<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Hello MUI</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<link rel="stylesheet" href="../../css/mui.min.css">
		<link rel="stylesheet" href="../../css/app.css">
		<style>
			h4.mui-ellipsis {
				line-height: 20px;
			}
			.readed {
				font-weight: normal;
			}
			.due {
				font-weight: normal;
				color: #8f8f94;

			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">消息列表</h1>
		</header>

		<div class="mui-content" id="menuList">

			<ul id="parent" class="mui-table-view mui-table-view-striped mui-table-view-condensed" style="margin-top:0">

		        
		     </ul>
		</div>

	</body>
	<script src="../../js/mui.min.js"></script>
	<script src="../../js/template.js"></script>
	<script src="../../js/app.js"></script>
	<script src="../../js/_API.js"></script>
	
	<script id="tmpl" type="text/html">
		{{each datas as value i}}
        <li class="mui-table-view-cell">
        	<a class="mui-navigate-right" new-window="/view/main/noticeDetail.html" new-window-data-index="{{i}}">
	            <div class="mui-table">
	                <div class="mui-table-cell mui-col-xs-10">
	                    <h4 class="mui-ellipsis readed">{{value.title}}</h4>
	                    <p class="mui-h6 mui-ellipsis">发布时间：{{value.createTime}}</p>
	                </div>
	            </div>
        	</a>
        </li>
        {{/each}}

	</script>
	
	<script>
		mui.init();
		
		mui.plusReady(function(){
			_API.ajax2('notices/queryPushedMsg', {}, true)
			.success(function(json){
				
				var datas = [];
				for(var i=0; i<json.data.length; i++) {
					var d = json.data[i];
					datas.push({data: JSON.parse(d.data)});
				}
				pushNewWindowData(datas)
				
	        	var html = template('tmpl', {datas: json.data});
				document.getElementById('parent').innerHTML = html;
			}).error(function(json){
	     	   	plus.nativeUI.toast(json.msgInfo);
			});
		});
	</script>

</html>